//package com.rbac.controller.test;
//
//import com.common.Result;
//import com.domain.dto.test.EmployeeRoleDto;
//import com.rbac.exception.CommonException;
//import com.rbac.pojo.Employee;
//import com.rbac.service.test.impl.EmployeeServiceImpl;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
//@RestController
//@RequestMapping("/Man/employee")
//public class EmployeeController {
//
//    @Autowired
//    private EmployeeServiceImpl employeeService;
//
//    @GetMapping("/list")
//    public Result getList(Integer pageNum, Integer pageSize){
//        return employeeService.getList(pageNum, pageSize);
//    }
//
//    @DeleteMapping("/delete")
//    public Result delete(Integer id){return employeeService.delete(id);}
//
//    @PostMapping("/add")
//    public Result save(@RequestBody @Validated({Employee.Insert.class}) Employee employee){return employeeService.save(employee);}
//
//    //updateEmployee v2
//    @PutMapping("/v2/update")
//    private Result updateEmployee(@RequestBody EmployeeRoleDto employeeRoleDto){
////        System.out.println(employeeRoleDto);
////        Employee employee = employeeRoleDto.getEmployee();
////        List<Integer> array = employeeRoleDto.getArray();
//        return employeeService.updateEmployeeRole(employeeRoleDto);
//    }
//    @PutMapping("/update")
//    public Result update(@RequestBody @Validated({Employee.Update.class}) Employee employee){return employeeService.update(employee);}
//
//    @GetMapping("/info")
//    public Result info(Integer id){
//        Employee employee = employeeService.getEmployeeById(id);
//        if(employee == null){
//            throw new CommonException("查询员工信息为空");
//        }
//        return Result.success(employee);
//    }
//
//    @GetMapping("/listAll")
//    public Result listAll(){
//        List<Employee> employeeList = employeeService.getEmployeeAllById();
//        if(employeeList.isEmpty()){
//            throw new CommonException("查询员工信息为空,全部数据为空");
//        }
//        return Result.success(employeeList);
//    }
//    @GetMapping("/listLike")
//    public Result listLike(String name){
//        List<Employee> employees = employeeService.listLike(name);
//        if(employees.isEmpty()){
//            throw new CommonException("跟据'"+name+"'关键字查询员工为空");
//        }
//        return Result.success(employees);
//    }
//    @GetMapping("/updateState")
//    public Result updateState(@RequestParam("id") Integer id, @RequestParam("admin") Boolean admin ){
//        return employeeService.updateState(id, admin);
//    }
//}
